<?php

class Form_SysFliter extends QForm
{
    function __construct($action)
    {
        // 调用父类的构造函数
        parent::__construct('form_SysFliter', $action);

        // 从配置文件载入表单
        $filename = rtrim(dirname(__FILE__), '/\\') . DS . 'searchsys.yaml';
        $this->loadFromConfig(Helper_YAML::loadCached($filename));

        //定义表单名称
        $this->_subject = '查询系统日志';
		
		$parent_id_items = OldEventlog::find()->group('sztype')->getAll()->toHashMap('sztype', 'sztype');
		$parent_id_items=$this->_encodeUTF8($parent_id_items);
		$parent_id_items[''] = '无';
        ksort($parent_id_items);
		$parent_id_items['all'] = '全部';
		$parent_id_items=array_reverse($parent_id_items);
		//dump($parent_id_items);
        $this['sztype']->items = $parent_id_items;
		
		//$this['sztype']->items = 
		$this['ordercol']->items = array(''=>'默认','szsource'=>'来源','szdesc'=>'内容','logid'=>'事件ID','sztype'=>'类型','time'=>'日期');

		$this['desc']->items = array('desc'=>'倒序','asc'=>'顺序');
        //$this['infotype']->items = array(''=>'全部','process'=>'进程信息','fileinfo'=>'文件信息','tcpconns'=>'连接信息','cmdinfo'=>'命令行信息','reginfo1'=>'注册表信息','trminallog'=>'远程登录信息','reginfo'=>'安全策略变动');
//        // 添加表单元素
//        $this->add(QForm::ELEMENT, 'role_id', array(
//            '_ui' => 'checkboxgroup',
//            '_label' => '选择角色',
//            //'value' => '[4,5]',
//            'items' => Admin_Roles::find()
//            //->order('name ASC')
//            ->getAll()
//            ->toHashMap('role_id', 'rolename'),
//            ));
//
//        // 添加一个隐藏字段到表单
//        $this->add(QForm::ELEMENT, 'user_id', array('_ui' => 'hidden')s);

		//

        // 为 group_id 元素设置可用的值，该元素的 _ui 是 dropdownlist

    }

	protected function _encodeUTF8($array){



	   foreach($array as $key=>$value){

		//$key=iconv("GB2312","UTF-8",$key);
			if($key!=''){
	      $array[$key] = !is_array($value)?iconv("GB2312","UTF-8",$value):self::_encodeUTF8($array[$key]);
			}
			

	   }
	   $newarray=array();
		foreach($array as $key=>$value){
		if($array[$key]!='')
		$newarray[iconv("GB2312","UTF-8",$key)]=$array[$key];
		
		}
		

	   return $newarray;



	}
}


?>
